package mytomcat.servlet.base;

import mytomcat.core.MyRequest;
import mytomcat.core.MyResponse;

/**
 * <ul>
 * <li>Title:MyServlet</li>
 * <li>Description: TODO </li>
 * <li>Copyright: Copyright (c) 2018</li>
 * </ul>
 *
 * @author swc
 * @version     V1.0
 * @date 2020/4/20 0020 上午 9:54
 */
public abstract class MyServlet {

    public abstract  void doGet(MyRequest myRequest, MyResponse myResponse);

    public abstract  void doPost(MyRequest myRequest,MyResponse myResponse);


    public  void service(MyRequest myRequest,MyResponse myResponse){
        if("POST".equalsIgnoreCase(myRequest.getMethod())){
            doPost(myRequest,myResponse);
        }else if("GET".equalsIgnoreCase(myRequest.getMethod())){
            doGet(myRequest,myResponse);
        }
    }

}
